/**业务code */
// export const WorkCode = 0

// const getCode = (code: number) => +`${WorkCode}6${code}`
const getCode = (code: number) => +code

/**
 * @description: 请求结果集
 */
export enum ResultEnum {
  /**成功状态码 */
  SUCCESS = getCode(2000),
  /**数据校验失败 */
  ERROR = getCode(4000),
  /**未经授权 */
  UNAUTHORIZED = getCode(4001),
  /**服务器开小差 */
  ERR_INTERNAL_SERVER = getCode(5000),
  /**账号格式错误 */
  ERR_USERNAME_INVALID = getCode(6001),
  /**密码格式错误 */
  ERR_PASSWORD_INVALID = getCode(6002),
  /**新密码不能与旧密码相同 */
  WRONG_COMMON_PASSWORD = getCode(6003),
  /**两次密码输入不一致 */
  WRONG_PASSWORD_NOT_SAME = getCode(6004),
  /**原密码错误 */
  WRONG_OLD_PASSWORD = getCode(6005),
  /**账号或密码不正确 */
  WRONG_PASSWORD = getCode(6006),
  /**当前邮箱已存在相同的账号类型 */
  ErrEmailExistType = getCode(7001),
  /**acme账户创建失败 */
  ErrAcmeAccountCreate = getCode(7002),
  /**名称已存在 */
  ErrNameExist = getCode(7003),
  /**证书创建失败 */
  ErrCertCreateFailed = getCode(7004),
  /**域名格式错误 */
  ErrDomainFormatError = getCode(7005),
  /**已关联证书，无法删除 */
  ErrDeleteRelatedCert = getCode(7006)
}

// http://wiki.test.com/pages/viewpage.action?pageId=20515120
export const accountErrorMap = [
  getCode(6001),
  // getCode(602),
  getCode(6002),
  getCode(6006)
]

export const passwordErrorMap = [getCode(6003), getCode(6004), getCode(6005)]

/**
 * @description: 请求方式
 */
export enum RequestEnum {
  GET = 'GET',
  POST = 'POST',
  PUT = 'PUT',
  DELETE = 'DELETE'
}

/**
 * @description:  headers contentType
 */
export enum ContentTypeEnum {
  // json
  JSON = 'application/json;charset=UTF-8',
  // form-data qs
  FORM_URLENCODED = 'application/x-www-form-urlencoded;charset=UTF-8',
  // form-data  upload
  FORM_DATA = 'multipart/form-data;charset=UTF-8'
}
